import { Component, defineInjectable } from '@angular/core';
import { Product } from './product';

@Component({
  selector: 'inventory-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title(title: any) {
    throw new Error('Method not implemented.');
  }
  products:Product[];
  constructor(){
   this.products=[
     new Product(
       'MYSHOES',
       'Black Running Shoes',
       '/assets/imgs/products/black-shoes.jpg',
       ['Men','Shoes','Running Shoes'],
       109.99),
       new Product( 
        'NEATOJACKET', 
        'Blue Jacket', 
        '/assets/imgs/products/blue-jacket.jpg', 
        ['Women', 'Apparel', 'Jackets & Vests'], 
        238.99), 
        new Product( 
        'NICEHAT', 
        'A Nice Black Hat', 
        '/assets/imgs/products/black-hat.jpg', 
        ['Men', 'Accessories', 'Hats'], 
        29.99) 
        ];
  }
  
  onProductSelected(product:Product){
    console.log('在根组件中，响应产品：'+product.name+'选中事件！！');
  }
}
